/**
 * 系统开窗资料查询
 * @author ganjia
 * @date 2019/09/25
 */
define(function () {

    var self,
        doc = document,
        app = win.app,
        layui = win.layui,
        element,
        table,
        table_gwax = {},
        cols = [[
            { type : "checkbox" , fixed: 'left'},
            { field: "METHOD" , title: "开窗编号", width: 100,fixed:'left',sort:true,search:'default'},
            { field: "DESCRIPTION" , title: "开窗说明", width: 180,sort:true,search:'default'},
            { field: "PARAMETER" , title: "传参", width: 180},
            { field: "SQL" , title: "查询SQL", width: 120,hide:true}
        ]],
        qrySettingAction,
        editArea = ['600px', '360px']
    ;

    var Qry = app.Module.extend({
        init: function () {
            self = this;
            self._super({
                _tag: 'qry',
                _searchs: [{
                    id: 'qry', tableId: 'qry_table', datas: cols[0]
                }],
                _loadTplsFull: [
                ]
            }, win);
        },

        initTable: function () {
            layui.use(['table'], function () {
                table = layui.table;
                table.render({
                    elem: app.getByid(doc, 'qry_table'),
                    url: g_ctxPath + 'qry/getQueryList',
                    method: 'post',
                    id: 'qry_table',
                    size: _layuiConfig.ui_size,
                    autoSort: false, //禁用前端自动排序
                    toolbar: '#table-toolbar',
                    defaultToolbar: ['filter'],
                    cols: cols,
                    loading: true,
                    page: true,
                    where: '',
                    done: function (res, curr, count) {

                    }
                });

                //监听事件
                table.on('toolbar(qry_table)', function (obj) {
                });
            });
        },

        reloadTableCurr: function () {
            self._reloadTable({id: 'qry_table', where: table_gwax});
        },

        _ready: function () {
            this._super({
                vue: [{
                    el: '#page',
                    data: '',
                    searchId: 'qry',
                    methods: {
                    }

                }]
            });
            self.initTable();
        },
        _lazy: function () {
            this._super();
            layui.use(['table'], function () {
                element = layui.element;
            });
        }
    });

    return new Qry();

});